#ifndef __RTC_H
#define __RTC_H	 

#include "sys.h" 
#include "typedef.h"

typedef struct {
    unsigned short year;
    unsigned char month;
	  unsigned char week;
    unsigned char date;
    unsigned char hour;
    unsigned char min;
    unsigned char sec;
}T_TimeFmt;
    
uint8_t rtc_init(void);						//RTC初始化

ErrorStatus RTC_Set_Time(uint8_t hour,uint8_t min,uint8_t sec,uint8_t ampm);			//RTC时间设置
ErrorStatus RTC_Set_Date(uint8_t year,uint8_t month,uint8_t date,uint8_t week); 		//RTC日期设置




void RTC_Set_AlarmA(uint8_t week,uint8_t hour,uint8_t min,uint8_t sec);		//设置闹钟时间(按星期闹铃,24小时制)
void RTC_Set_WakeUp(uint32_t wksel,uint16_t cnt);					//周期性唤醒定时器设置

int rtc_set_time(int year, uint8_t mon, uint8_t day, uint8_t hour, uint8_t min, uint8_t sec,uint8_t week);
int rtc_set_time_by_sec(uint64_t sec);

void rtc_get_current_time(T_TimeFmt *tim);
int rtc_get_currt_time_sec(void);

uint32_t rtc_get_currt_hour(void);
uint32_t rtc_get_currt_minute(void);
void rtc_get_currt_time_str(char_t *time, int32_t len);
void rtc_get_currt_time_format(char_t *time, int32_t len);
void RTC_GetTimeFmtStr(T_TimeFmt * tim, char *str);
unsigned int RTC_GetTimeFmtSec(T_TimeFmt *tim);
void GetTimeStrFromSec(unsigned int sec, char *str);

#endif













